<?php

Class Product extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->Model('sanpham_model');
        // $this->load->helper("url");
    }

    public function index()
    {
        $data['protes'] = $this->sanpham_model->getProductByCate(5);
        $data['protes2'] = $this->sanpham_model->menu_left($_GET['catid']);
        $data['category'] = $this->sanpham_model->category(0);

        foreach ($data['category'] as &$item) {
            $item['items'] = $this->sanpham_model->category($item['id']);
        }
        //$data['table'] = $this->sanpham_model->jointable('prent_id');
        $data['table'] = $this->sanpham_model->jointable('prent_id');
        $this->load->view("product-view", $data);

    }

    public function detail()
    {
        $product = $this->db->select('*')->where('id', $_REQUEST['id'])->get('sanpham')->row_array();
        $data = array('product' => $product);
        $this->load->view("detail-view", $data);
    }
    /*phan trang*/

}
?>